package ABC.Z314.KAOSHI;

import java.util.Scanner;

public class Super {public static void main(String[] args) {
    Super s = new Super();
    Scanner in = new Scanner(System.in);
    while (true) {
        System.out.println("1.会员开卡    2.用户涨分   3.兑换礼品   4.查看会员信息:");
        System.out.print("请输入你要办理的业务：");
        int num = in.nextInt();
        int i = 0;
        if (num == 1) {
            while (true) {
                System.out.print("请输入你的姓名：");
                String name1 = in.next();
                System.out.print("请输入你的电话：");
                float phone = in.nextFloat();
                System.out.print("请输入你的会员号：");
                int num1 = in.nextInt();
                Card c1 = new Card(name1, phone, num1, 0);
                boolean aa = s.add(c1);
                if (aa) {
                    System.out.println("开卡成功！");
                    break;
                } else {
                    System.out.println("会员号已经存在请重新输入：");
                    continue;
                }
            }
        }
        if (num == 2) {
            while (true) {
                System.out.print("请输入你的会员号:");
                int num1 = in.nextInt();
                System.out.print("你想要涨几分：");
                int jifen = in.nextInt();
                boolean jf = s.inc(num1, jifen);
                if (jf) {
                    System.out.println("涨分成功！");
                    break;
                } else {
                    System.out.println("会员账号有误，请重新输入!");
                    continue;
                }
            }

        }
        if (num == 3) {
            System.out.println("1.餐巾纸   2. 剃须刀     3.砂锅");
            System.out.print("请选择你要兑换的礼品(输入序号即可)：");
            int lipinleixing = in.nextInt();
            System.out.print("请输入你的会员号：");
            int vipnum = in.nextInt();
            String dh = s.duihuan(vipnum, lipinleixing);
            System.out.println(dh == null ? "兑换失败" :"兑换"+ dh+"成功");
        }
        if(num==4){
            System.out.print("请输入你的姓名：");
            String name= in.next();
            s.look(name);
        }
    }
}
}
